

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import webpage.CreateDBConnection;

/**
 * Servlet implementation class PeopleProfile
 */
@WebServlet("/PeopleProfile")
public class PeopleProfile extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	ArrayList<String>buddyDetails = new ArrayList<String>();
    public PeopleProfile() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String emailaddress = request.getParameter("emailaddress");
		String friends = request.getParameter("friends"); 
		System.out.println(emailaddress);
		CreateDBConnection create = new CreateDBConnection();
		buddyDetails = create.getDetails(emailaddress);
			HttpSession session = request.getSession(true);
			session.setAttribute("buddyDetails", buddyDetails);
			session.setAttribute("friends", friends);
			System.out.println(buddyDetails.get(2));
			RequestDispatcher rd;
			rd= request.getRequestDispatcher("PeopleProfile.jsp");
			rd.forward(request,response);

		} 

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
	}

}
